import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/view/HelloWorld'

Vue.use(Router)
console.log('window.__POWERED_BY_QIANKUN__', window.__POWERED_BY_QIANKUN__)
const router = new Router({
    mode: 'history',
    base: window.__POWERED_BY_QIANKUN__ ? "/app-vue/" : "/",
    routes: [
        {
            path: '/',
            name: "HelloWorld",
            component: HelloWorld,
        },
        {
            path: '/about',
            name: "About",
            component: () => import('@/view/About.vue'),
        }
    ]
})

//路由跳转前做点什么
router.beforeEach((to, from, next) => {
    // console.log(to)
    next()
});

//路由跳转后做点什么
router.afterEach((to) => {
    // window.scrollTo(0, 0)
});
export default router;